/**
 * File Comment: Ita a GUI
 */
package edu.gatech.oad.project.presentation;
//$codepro.audit.disable
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 * This class is a panel that allows the user
 * to interact with the GUI to view his or her
 * medical history.
 * 
 * @author Group 17
 * @version 1
 */
public class PatientMedHistory extends JPanel {
  
  /**
   * Field driver: holds the Driver connected to the GUI
   */
  private Driver driver;
  
  /**
   * Field btnViewPreviousAppointments: past appointments button
   */
  public JButton btnViewPreviousAppointments;
  
  /**
   * Field btnBackToHome: back button
   */
  public JButton btnBackToHome;

 /**
  * Construtor.
  * 
  * @param driver the Driver connected to the GUI
  */
 public PatientMedHistory(Driver driver) {
   this.driver = driver;
  GridBagLayout gridBagLayout = new GridBagLayout();
  gridBagLayout.columnWidths = new int[]{0, 0, 0, 0, 0, 0, 0};
  gridBagLayout.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  gridBagLayout.columnWeights = new double[]{0.0, 0.0, 1.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
  gridBagLayout.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
  setLayout(gridBagLayout);
  
  JLabel lblPatientMedicalHistory = new JLabel("Patient Medical History");
  lblPatientMedicalHistory.setFont(new Font("Lucida Grande", Font.PLAIN, 30));
  GridBagConstraints gbc_lblPatientMedicalHistory = new GridBagConstraints();
  gbc_lblPatientMedicalHistory.gridwidth = 9;
  gbc_lblPatientMedicalHistory.insets = new Insets(0, 0, 5, 0);
  gbc_lblPatientMedicalHistory.gridx = 0;
  gbc_lblPatientMedicalHistory.gridy = 1;
  add(lblPatientMedicalHistory, gbc_lblPatientMedicalHistory);
  
  JLabel lblPatientInformation = new JLabel("Name");
  GridBagConstraints gbc_lblPatientInformation = new GridBagConstraints();
  gbc_lblPatientInformation.anchor = GridBagConstraints.EAST;
  gbc_lblPatientInformation.insets = new Insets(0, 0, 5, 5);
  gbc_lblPatientInformation.gridx = 0;
  gbc_lblPatientInformation.gridy = 3;
  add(lblPatientInformation, gbc_lblPatientInformation);
  
  JLabel label_1 = new JLabel("");
  GridBagConstraints gbc_label_1 = new GridBagConstraints();
  gbc_label_1.insets = new Insets(0, 0, 5, 5);
  gbc_label_1.gridx = 2;
  gbc_label_1.gridy = 3;
  add(label_1, gbc_label_1);
  
  JLabel lblSex = new JLabel("Sex");
  GridBagConstraints gbc_lblSex = new GridBagConstraints();
  gbc_lblSex.anchor = GridBagConstraints.EAST;
  gbc_lblSex.insets = new Insets(0, 0, 5, 5);
  gbc_lblSex.gridx = 0;
  gbc_lblSex.gridy = 4;
  add(lblSex, gbc_lblSex);
  
  JLabel lblAge = new JLabel("Age");
  GridBagConstraints gbc_lblAge = new GridBagConstraints();
  gbc_lblAge.anchor = GridBagConstraints.EAST;
  gbc_lblAge.insets = new Insets(0, 0, 5, 5);
  gbc_lblAge.gridx = 0;
  gbc_lblAge.gridy = 5;
  add(lblAge, gbc_lblAge);
  
  JLabel label = new JLabel("");
  GridBagConstraints gbc_label = new GridBagConstraints();
  gbc_label.insets = new Insets(0, 0, 5, 5);
  gbc_label.gridx = 2;
  gbc_label.gridy = 5;
  add(label, gbc_label);
  
  JLabel lblAllergies = new JLabel("Allergies");
  GridBagConstraints gbc_lblAllergies = new GridBagConstraints();
  gbc_lblAllergies.anchor = GridBagConstraints.EAST;
  gbc_lblAllergies.insets = new Insets(0, 0, 5, 5);
  gbc_lblAllergies.gridx = 0;
  gbc_lblAllergies.gridy = 6;
  add(lblAllergies, gbc_lblAllergies);
  
  JLabel label_2 = new JLabel("");
  GridBagConstraints gbc_label_2 = new GridBagConstraints();
  gbc_label_2.insets = new Insets(0, 0, 5, 5);
  gbc_label_2.gridx = 2;
  gbc_label_2.gridy = 6;
  add(label_2, gbc_label_2);
  
  JLabel lblAddress = new JLabel("Address");
  GridBagConstraints gbc_lblAddress = new GridBagConstraints();
  gbc_lblAddress.anchor = GridBagConstraints.EAST;
  gbc_lblAddress.insets = new Insets(0, 0, 5, 5);
  gbc_lblAddress.gridx = 0;
  gbc_lblAddress.gridy = 7;
  add(lblAddress, gbc_lblAddress);
  
  JLabel label_3 = new JLabel("");
  GridBagConstraints gbc_label_3 = new GridBagConstraints();
  gbc_label_3.insets = new Insets(0, 0, 5, 5);
  gbc_label_3.gridx = 2;
  gbc_label_3.gridy = 7;
  add(label_3, gbc_label_3);
  
  JLabel lblEmail = new JLabel("Email");
  GridBagConstraints gbc_lblEmail = new GridBagConstraints();
  gbc_lblEmail.anchor = GridBagConstraints.EAST;
  gbc_lblEmail.insets = new Insets(0, 0, 5, 5);
  gbc_lblEmail.gridx = 0;
  gbc_lblEmail.gridy = 8;
  add(lblEmail, gbc_lblEmail);
  
  JLabel label_4 = new JLabel("");
  GridBagConstraints gbc_label_4 = new GridBagConstraints();
  gbc_label_4.insets = new Insets(0, 0, 5, 5);
  gbc_label_4.gridx = 2;
  gbc_label_4.gridy = 8;
  add(label_4, gbc_label_4);
  
  JLabel lblPhoneNumber = new JLabel("Phone Number");
  GridBagConstraints gbc_lblPhoneNumber = new GridBagConstraints();
  gbc_lblPhoneNumber.anchor = GridBagConstraints.EAST;
  gbc_lblPhoneNumber.insets = new Insets(0, 0, 5, 5);
  gbc_lblPhoneNumber.gridx = 0;
  gbc_lblPhoneNumber.gridy = 9;
  add(lblPhoneNumber, gbc_lblPhoneNumber);
  
  JLabel label_5 = new JLabel("");
  GridBagConstraints gbc_label_5 = new GridBagConstraints();
  gbc_label_5.insets = new Insets(0, 0, 5, 5);
  gbc_label_5.gridx = 2;
  gbc_label_5.gridy = 9;
  add(label_5, gbc_label_5);
  
  JLabel lblInsuranceCarrier = new JLabel("Insurance Carrier");
  GridBagConstraints gbc_lblInsuranceCarrier = new GridBagConstraints();
  gbc_lblInsuranceCarrier.anchor = GridBagConstraints.EAST;
  gbc_lblInsuranceCarrier.insets = new Insets(0, 0, 5, 5);
  gbc_lblInsuranceCarrier.gridx = 0;
  gbc_lblInsuranceCarrier.gridy = 10;
  add(lblInsuranceCarrier, gbc_lblInsuranceCarrier);
  
  JLabel label_6 = new JLabel("");
  GridBagConstraints gbc_label_6 = new GridBagConstraints();
  gbc_label_6.insets = new Insets(0, 0, 5, 5);
  gbc_label_6.gridx = 2;
  gbc_label_6.gridy = 10;
  add(label_6, gbc_label_6);
  
  JLabel lblPharmacy = new JLabel("Pharmacy");
  GridBagConstraints gbc_lblPharmacy = new GridBagConstraints();
  gbc_lblPharmacy.anchor = GridBagConstraints.EAST;
  gbc_lblPharmacy.insets = new Insets(0, 0, 5, 5);
  gbc_lblPharmacy.gridx = 0;
  gbc_lblPharmacy.gridy = 11;
  add(lblPharmacy, gbc_lblPharmacy);
  
  JLabel label_7 = new JLabel("");
  GridBagConstraints gbc_label_7 = new GridBagConstraints();
  gbc_label_7.insets = new Insets(0, 0, 5, 5);
  gbc_label_7.gridx = 2;
  gbc_label_7.gridy = 11;
  add(label_7, gbc_label_7);
  
  JLabel lblMisc = new JLabel("Misc");
  GridBagConstraints gbc_lblMisc = new GridBagConstraints();
  gbc_lblMisc.anchor = GridBagConstraints.EAST;
  gbc_lblMisc.insets = new Insets(0, 0, 5, 5);
  gbc_lblMisc.gridx = 0;
  gbc_lblMisc.gridy = 12;
  add(lblMisc, gbc_lblMisc);
  
  JLabel label_8 = new JLabel("");
  GridBagConstraints gbc_label_8 = new GridBagConstraints();
  gbc_label_8.insets = new Insets(0, 0, 5, 5);
  gbc_label_8.gridx = 2;
  gbc_label_8.gridy = 12;
  add(label_8, gbc_label_8);
  
  btnViewPreviousAppointments = new JButton("Past Appointments");
  btnViewPreviousAppointments.addActionListener(new ButtonListener1(this));
  GridBagConstraints gbc_btnViewPreviousAppointments = new GridBagConstraints();
  gbc_btnViewPreviousAppointments.gridwidth = 3;
  gbc_btnViewPreviousAppointments.insets = new Insets(0, 0, 5, 5);
  gbc_btnViewPreviousAppointments.gridx = 1;
  gbc_btnViewPreviousAppointments.gridy = 13;
  add(btnViewPreviousAppointments, gbc_btnViewPreviousAppointments);
  
  btnBackToHome = new JButton("Back to Home");
  btnBackToHome.addActionListener(new ButtonListener2(this));
  GridBagConstraints gbc_btnBackToHome = new GridBagConstraints();
  gbc_btnBackToHome.insets = new Insets(0, 0, 5, 5);
  gbc_btnBackToHome.gridx = 4;
  gbc_btnBackToHome.gridy = 13;
  add(btnBackToHome, gbc_btnBackToHome);
 } // end constructor method

 /**
  * Get the Driver.
  * 
  * @return the Driver connected to the GUI
  */
 public Driver getDriver()
 {
   return this.driver;
 } // end getDriver method
 
 /**
  * This private inner class implements ActionListener for btnViewPreviousAppointments
  * 
  * @author Group 17
  * @version 1
  */
 private class ButtonListener1 implements ActionListener
 {
   /**
    * Field mh: the PatientMedHistory being used
    */
   private PatientMedHistory mh;
   
   /**
    * Field driver: holds the Driver connected to the GUI
    */
   private Driver driver;
   
   /**
    * Constructor.
    * 
    * @param mh the PatiendMedHistory being used
    */
   private ButtonListener1(PatientMedHistory mh)
   {
     this.mh = mh;
     this.driver = mh.getDriver();
   } // end constructor method
   
   /**
    * Default method for ActionListener.
    * 
    * @param e the ActionEvent triggering the ActionListener
    */
   public void actionPerformed(ActionEvent e)
   {
     //write code to pop up a list of past appointments
   } // end actionPerformed method
 } // end ButtonListener1 class
 
 /**
  * This private inner clas implements ActionListener for btnBackToHome
  */
  private class ButtonListener2 implements ActionListener
 {
    /**
     * Field mh: the PatientMedHistory being used
     */
   private PatientMedHistory mh;
   
   /**
    * Field driver: holds the Driver connected to the GUI
    */
   private Driver driver;
   
   /**
    * Constructor.
    * 
    * @param mh the PatientMedHistory being used
    */
   private ButtonListener2(PatientMedHistory mh)
   {
     this.mh = mh;
     this.driver = mh.getDriver();
   } // end constructor method
   
   /**
    * Default method for ActionListener.
    * 
    * @param e the ActionEvent triggering the ActionListener
    */
   public void actionPerformed(ActionEvent e)
   {
     this.driver.getFrame().setContentPane(new PatientHome(this.driver));
     this.driver.getFrame().pack();
   } // end actionPerformed method
 } // end ButtonListener2 class
} // end PatientMedHistory class